<?php

namespace Respect\SimpleRouter;

use Respect\Environment\EnvironmentableInterface;

class Router
{

    protected $path = '';
    protected $controllers = array();

    public function __construct(EnvironmentableInterface $env, $namespace='')
    {
        $this->path = trim($env->getResourcePath(), '/');
        $pathParts = explode('/', $this->path);
        $controllerName = array_shift($pathParts);
        $controllerParts = preg_split(
                '#[A-Z0-9[:punct:]]#',
                $controllerName,
                null,
                PREG_SPLIT_NO_EMPTY
        );
        $controllerName = implode(array_map('ucfirst', $controllerParts));
        $this->controllers[] = trim($namespace . '\\' . $controllerName, '\\');
    }

    public function getControllerClassNames()
    {
        return $this->controllers;
    }

}